package com.lphl.pet.util;

import android.app.Dialog;
import android.content.Context;
import android.content.Intent;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.TextView;

import com.lphl.pet.R;
import com.lphl.pet.activity.WelcomUseActivity;


public class DialogUtil {

	private static DialogUtil dialogUtil = null;
	private DialogUtil(){}
	public static DialogUtil getInstance(){
		if(dialogUtil == null){
			dialogUtil = new DialogUtil();
		}
		return dialogUtil;
	}
	
	public void showTradeeditionDialog(final Context ct){
		final Dialog dialog = new Dialog(ct, R.style.Dialog);
		dialog.setContentView(R.layout.yh_card_dialog);
		dialog.getWindow().setLayout(dialog.getWindow().getWindowManager().getDefaultDisplay().getWidth(),
				dialog.getWindow().getAttributes().WRAP_CONTENT);
		
		TextView tv_message = (TextView) dialog.findViewById(R.id.tv_message);
		TextView know = (TextView) dialog.findViewById(R.id.tv_i_know);
		TextView tv_understand_info = (TextView) dialog.findViewById(R.id.tv_understand_info);
		
			tv_message.setText(ct.getResources().getString(R.string.first_dialog_putongban));
			tv_understand_info.setText(ct.getResources().getString(R.string.first_dialog_btn_putongban));
			know.setOnClickListener(new OnClickListener() {
				
				@Override
				public void onClick(View v) {
					dialog.dismiss();
				}
			});
			
			tv_understand_info.setOnClickListener(new OnClickListener() {
				
				@Override
				public void onClick(View v) {
                    // 了解更多信息
					Intent intent = new Intent(ct, WelcomUseActivity.class);
					ct.startActivity(intent);
					dialog.dismiss();
				}
			});
			dialog.show();
	}
	public void showUltimateDialog(final Context ct){
		final Dialog dialog = new Dialog(ct, R.style.Dialog);
		dialog.setContentView(R.layout.yh_card_dialog);
		dialog.getWindow().setLayout(dialog.getWindow().getWindowManager().getDefaultDisplay().getWidth(),
				dialog.getWindow().getAttributes().WRAP_CONTENT);
		
		TextView tv_message = (TextView) dialog.findViewById(R.id.tv_message);
		TextView know = (TextView) dialog.findViewById(R.id.tv_i_know);
		TextView tv_understand_info = (TextView) dialog.findViewById(R.id.tv_understand_info);
		
		tv_message.setText(ct.getResources().getString(R.string.first_dialog_qijianban));
		tv_understand_info.setText(ct.getResources().getString(R.string.first_dialog_btn_qijianban));
		know.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				dialog.dismiss();
			}
		});
		
		tv_understand_info.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
                // 了解更多信息
				Intent intent = new Intent(ct, WelcomUseActivity.class);
				ct.startActivity(intent);
				dialog.dismiss();
			}
		});
		dialog.show();
	}

}
